<table class="table table-responsive" id="orders-table">
    <thead>
        <th>ID</th>
        <th>单据号</th>
        <th>经销商</th>
        <th>客户</th>
        <th>价格</th>
        <th>数量</th>
        <th>类型</th>
        <th>状态</th>
        <th>备注</th>
        <th>省</th>
        <th>日期</th>
        <th colspan="3">操作</th>
    </thead>
    <tbody>
    @foreach($orders as $order)
        <tr>
            <td>{!! $order->id !!}</td>
            <td>{!! $order->sn !!}</td>
            <td>{!! $order->user?$order->user->name:'' !!}</td>
            <td>{!! $order->customer?($order->customer->name.'-'.$order->customer->company_name):'' !!}</td>
            <td>{!! $order->price !!}</td>
            <td>{!! $order->number !!}</td>
            <td>{!! $order->type==1?'普通订单':'订购会订单' !!}</td>
            <td>{!! $order->type==1?'不需要审核':($order->status==1?'审核通过':($order->status==-1?'审核失败':'待审核')) !!}</td>
            <td>{!! $order->remark !!}</td>
            <td>{!! $order->province !!}</td>
            <td>{!! $order->created_date !!}</td>
            <td>
                {!! Form::open(['route' => ['orders.destroy', $order->id], 'method' => 'delete']) !!}
                <div class='btn-group'>
                    <a href="{!! route('orders.show', [$order->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
                    @if($order->type==2)
                        <a href="{!! route('orders.edit', [$order->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
                    @endif
                        {!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
                </div>
                {!! Form::close() !!}
            </td>
        </tr>
    @endforeach
    </tbody>
</table>